<template>
  <div>
    <el-button @click="add">
      添加
    </el-button>
     <el-table :data="tableData" >
    <el-table-column prop="id" label="序号"  />
    <el-table-column prop="role_name" label="角色"  />
  </el-table>
    </div>
</template>
<script setup>
import {ref,onMounted} from "vue";
import axios from "axios";
import {useRouter} from "vue-router";
let router=useRouter()
const add = () => {
  router.push('/add')
}
const all = () => {
  axios.get('http://127.0.0.1:8000/tadmin/ad/').then(res=>{
    tableData.value=res.data
  })
}

let tableData=ref()
onMounted(()=>{
  all()
})

</script>